c84e5b
@@ -259,9 +259,11 @@
public final class URISupport {
             path = path.substring(2);
         }
         int idx = path.indexOf('?');
-        if (idx > 0) {
+        // when the path has ?
+        if (idx != -1) {
             path = path.substring(0, idx);
         }
+        
         path = UnsafeUriCharactersEncoder.encode(path);
 
         // in case there are parameters we should reorder them
